//
//  UIImageView+FIDAnimation.m
//  3DPrint
//
//  Created by Fidetro on 2017/1/6.
//  Copyright © 2017年 Fidetro. All rights reserved.
//

#import "UIImageView+FIDAnimation.h"

@implementation UIImageView (FIDAnimation)

-(void)pointAnimationWithFileName:(NSString*)fileName imageCount:(NSInteger)imageCount {
    //如果当前正在执行动画，那么直接return
    if (self.isAnimating) {
        return;
    }
    
    
    NSMutableArray *images = [NSMutableArray array];
    for (int i = 0; i < imageCount; i++) {
        NSString *imageName = [NSString stringWithFormat:@"%@%d",fileName,i+1];
        UIImage *image = [UIImage imageNamed:imageName];
        //把创建好的图片添加到图片数组中
        [images addObject:image];
    }
    //设置 imageView的动画数据
    self.animationImages = images;
    //设置 播放时间
    self.animationDuration = 1;
    //设置 重复次数
    self.animationRepeatCount = 0;
    //运行动画
    [self startAnimating];
}

@end
